/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package rest.jbpm.identity;

import java.util.List;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.api.identity.User;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
/**
 *
 * @author jump
 */
public class FindUsersByGroupCmd implements Command<List<User>> {

    private final String groupId;

    public FindUsersByGroupCmd(String groupId) {
        this.groupId = groupId;
    }

    @Override
    public List<User> execute(Environment environment) {
        IdentitySession identitySession = environment.get(IdentitySession.class);
        return identitySession.findUsersByGroup(groupId);
    }

}
